#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


# def func():
#     print('start...')
#     while True:
#         yield '生成器返回的数据'
#
#
# obj = func()
# print(next(obj))
# print(next(obj))

import time


def func_a():
    while True:
        print('func_a..')
        yield  # yield语句暂停执行，等待被调用
        time.sleep(0.5)


def func_b(obj):
    while True:
        print('func_b..')
        obj.__next__()  # 迭代器返回下一个元素


a = func_a()
func_b(a)
